package my.study.java.lang.reflect.Constructor.examples;


import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;

public class Introduction {

	/**
	 * @param args
	 * @throws NoSuchMethodException 
	 * @throws InvocationTargetException 
	 * @throws IllegalAccessException 
	 * @throws InstantiationException 
	 * @throws SecurityException 
	 * @throws IllegalArgumentException 
	 */
	public static void main(String[] args) throws IllegalArgumentException, SecurityException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
		Class<?> arraylist = ArrayList.class;
		Constructor<?>[] construcors = arraylist.getDeclaredConstructors();
		for (Constructor<?> con : construcors) {
			pl(con);
		}
		@SuppressWarnings("unchecked")
		ArrayList<String> array = (ArrayList<String>) arraylist.getConstructor(int.class).newInstance(100);
		pl(array.add("1"));
	}
	public static void pl(Object o) {
		System.out.println(o);
	}
}
